/* 
 * This js file is used to create functions used data forms
 */

var _formChanged = false;

function handleFormChanged() 
{
    //$('#save_or_update').attr("disabled", false);
    _formChanged = true;
}

function member_profile_edit_doc_ready(){
	//The following code is used to determine if the form is dirty or not.	used in conjunction with common_form_functions.js 
	//http://www.mydogboris.com/2009/10/using-jquery-data-feature-to-detect-form-changes/
	$('#_profileForm input[type=text]').each(function (i) 
		{
			$(this).data('initial_value', $(this).val());
		});

	$('#_profileForm input[type=text]').keyup(function() 
			{
				if ($(this).val() != $(this).data('initial_value')) 
					handleFormChanged();
			});

	$('#_profileForm .editable').live('change paste', function() 
			{
			handleFormChanged();
			});

	//end dirty form code 

	$('a').click(function() {
		if (!confirmNavigation())
			return false;
		});

	$("#_close").click(function() {
								window.location = get_base_url() + 'index.php?/member_profile';
								return false;
								});
};